﻿using System;

namespace XNAGameEngine.DataStructures
{
    /// <summary>
    /// A wrapper for putting objects into a priority queue and specifying an
    /// arbitrary priority value.
    /// </summary>
    public struct PriorityQueueNode<T> : IComparable<PriorityQueueNode<T>>
    {
        /// <summary>
        /// The data that is represented by this node
        /// </summary>
        public T _nodeData;

        /// <summary>
        /// This is the value that will be compared for priority
        /// </summary>
        public int PriorityValue { get; set; }

        /// <summary>
        /// This needs to be implemented to have the comparisons
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int CompareTo(PriorityQueueNode<T> other)
        {
            if (PriorityValue > other.PriorityValue)
                return 1;

            return PriorityValue < other.PriorityValue ? -1 : 0;
        }
    }
}